<?php
namespace app\admin\controller\system;
use app\admin\ControllerBase;
use think\Request;
use app\admin\common;
use think\exception\ValidateException;
use app\admin\server\system\ShadowProduct as ShadowProductServer;
/**
 * @title 影映品设置
 */
class ShadowProduct extends ControllerBase{
	
	public function __construct(request $request){
		$this->REQUEST = $request;
        self::$s_server=new ShadowProductServer($request);
	}
	/**
	 * @title 查询规格
	 * @return string data.id (当对当前这条数据进行修改时需再上传此参数。如新添加的则无) 
	 * @return string data.money 金额
	 * @return string data.specifications 规格
	 */
	public function selectProduct(){
		$this->requestLog(__function__, $this->REQUEST->param(), '查询影映品规格');
		return $this->commonFunction(__function__);
	}
	/**
	 * @title 添加规格
	 * @param string data[0][specifications] 100*100 规格
	 * @param string data[0][money] 5.2 金额 
	 * @param string data[0][id] 1 当第一次添加参数后。第二次编辑时应该有该Id如果删除了则无	
	 * @param string data[1][specifications] 200*200 规格
	 * @param string data[1][money] 2.5 金额
	 * @param string data[1][id] 
	 */
	public function addProduct(){
		$_data=$this->REQUEST->param();
		try{
			foreach($_data['data'] as $k=>$v){
				$_check_flag=validate(\app\admin\validate\System::class)->scene(__function__)->check($v);
			}
		}catch(ValidateException $e){
			$this->getMessageCode('adminMessage.field.error',1);
            $this->ERROR = $this->ERROR . ',' . $e->getError();
			 return common::return_json_layui(false, $this->ERROR, $this->CODE);
		}
		
		$this->requestLog(__function__, $this->REQUEST->param(), '添加影映品规格');
		return $this->commonFunction(__function__);
	}
}
?>